package day5;

public class setandget {
    String name;
    private int age;

    public void reproduce() {
        System.out.println("我是" + name + "，今年" + age + "岁");
    }

    public void setAge(int num) {
        if (num > 0 && num < 100) {
            age = num;
        } else {
            System.out.println("数据非常不合理！");
        }
    }

    public int getAge() {
        return age;
    }
}
